<%@ taglib prefix="c" uri="/WEB-INF/tlds/hdiv-c.tld"%>
<%@ taglib prefix="form" uri="/WEB-INF/tlds/hdiv-spring-form-3_0_4.tld"%>
<%@ taglib uri="/WEB-INF/tlds/hdiv-spring.tld" prefix="spring"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<c:url value="mostrarHWF1005.html" var="equivalenciadeclientes"/>

  <script>
  function validar()
        {
        if(isNaN(document.forms[0].codEqui.value)){
            alert('Ingrese solo digitos por favor');
            document.forms[0].codEqui.focus();
            }
        else{
            moveForward('guarda');
            }
        }
  
        function guardar(){

            if (document.forms[0].codEqui.value == ''){
                alert('Ingresar el codigo de Equivalencia');
                document.forms[0].codEqui.focus();                
                return
            }

            if (document.forms[0].desEqui.value == ''){
                alert('Ingrese la descrpcion de Equivalencia');
                document.forms[0].desEqui.focus();                
                return
            }
            
            if (isNaN(document.forms[0].codEqui.value)){
                alert('Ingrese solo digitos por favor');
                document.forms[0].codEqui.focus();
                return
            }
            $("#estado").removeAttr("disabled");
            moveForward('guarda');        
        }
        function chekarKey(evt){
        evt = (evt) ? evt : event;
        var charCode = (evt.charCode) ? evt.charCode :((evt.which) ? evt.which : evt.keyCode);
        return charCode;
}
        function habilitaDeshabilitaChk()
            {   estadoTotal=false;  
                document.forms[0].accion.disabled=false;
            } 
  </script>
<form:form modelAttribute="form" action="${equivalenciadeclientes}">
<form:hidden path="accion"/>
<form:hidden path="cliente"/>
<form:hidden path="codDestino"/>
<form:hidden path="desDestino"/>
<form:hidden path="habilitarEstado"/>
<form:hidden path = "control"/>
<form:hidden path = "sucursal"/>

<table id="fullheighttable" width="775" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td align="left" valign="top" class="fondo_contenido padtop16left21">
      <table width="780" border="0" align="center" cellpadding="0" cellspacing="0" >
      <tr>
        <td height="22" align="left" valign="top" class="verdana11bazul">
            <ul class="navlist2">
            <li>
              EQUIVALENCIA DE CLIENTES
            </li>
            </ul></td>
        </tr>
      <tr>
        <td align="left" valign="top" class="borde_totalblanco"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="105" height="23" align="left" valign="top" class="verdana10bazul">Cliente Principal</td>
            <td height="23" align="left" valign="top" class="verdana10negro">
                <c:out value="${sessionScope.nombreCliente}"/>                
               </td>
          </tr>
                   
          <tr>
                <td width="105" height="23" align="left" valign="top" class="verdana10bazul">Cliente Destino</td>
                <td width="85%">
                    <c:out value="${form.desDestino}"/>
                </td>
          </tr>
          
        </table>
        </td>
      </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top" class="padtop16left21">
        <table>
            <tr>
             <td>
              <input type="button" class="boton" value="Cancela" onclick="moveForward('cancela')"/>
             </td>
             <td>
              <input type="button" class="boton" value="Guardar" onclick="javascript:guardar();"/>
             </td>
            </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td align="left" valign="top" class="padtop16left21">
        <table>
        <tr>
            <td width="200" height="23" align="left" valign="top" class="verdana10bazul">C&oacute;digo de Equivalencia</td>
            <td align="left" valign="bottom" class="padright10"><div class="fondo_txtbox90">
                <form:input maxlength="6" size="12" path="codEqui"/></div></td>
        </tr>
        <tr>
            <td width="200" height="23" align="left" valign="top" class="verdana10bazul">Descripci&oacute;n de Equivalencia</td>
            <td align="center" valign="bottom" class="padright10"><div class="fondo_txtbox257">
                <form:input path="desEqui" maxlength="45" size="50" onkeyup="javascript:var y=verificaDireccional(event);if(y=='true'){this.value=value.toUpperCase();}"/></div></td>
        </tr>
        <tr>
            <td width="200" height="23" align="left" valign="top" class="verdana10bazul">Estado</td>
            <td align="left" valign="bottom" class="padright10">
                    <form:select path="estado" cssStyle="height: 20px; width: 180px; font-family: Arial; font-size: 8pt">
                            <form:options items="${listEstado}"
                                    itemValue="codigo"
                                    itemLabel="descripcion"/>
                    </form:select>                    
            </td>
        </tr>        
        
        </table>
    </td>
  </tr>
</table>
</form:form>
<script>
document.forms[0].codEqui.focus();
if(document.forms[0].habilitarEstado.value=='no'){
document.forms[0].estado.disabled=true;
}
else{
document.forms[0].estado.disabled=false;
}
</script>
